5 Data Querying

In this chapter we are using the encoder model to extract 10 features from the images in the whole dataset. Afterwards we use these features to search for the images which are most similar to a user specified image by calculating one of three distance measurements.

Imports

Load Data

Load Model

Query

Encode full dataset

Using the encoder model we extract 10 features from all images in the combined test and train dataset.

Select 20 images

We are selecting the first 20 images of the combined dataset as test samples. Following we will search for the most similar images for each of the 20 images.

Encode sample images

Implement different distance metrics for calculating pairwise distances of two data tuples

Use 'euclid', 'manhatten' or 'cosine' as metric input parameter when using this function.

Calculate pairwise distances using "euclid"

Plot most similar images

Calculate pairwise distances using "cosine"

Plot most similar images